import { record_state, result } from '@/plugins/mate.js'

export const formConfig = [
    {
        name: 'scope_id_list',
        type: 'cascader',
        placeholder: '筛选范围',
        options: [],
    },
    {
        name: 'start_time',
        type: 'date',
        placeholder: '开始时间',
    },
    {
        name: 'end_time',
        type: 'date',
        placeholder: '结束时间',
    },
    {
        name: 'record_state',
        type: 'select',
        placeholder: '巡检状态',
        options: record_state.options,
    },
    {
        name: 'result',
        type: 'select',
        placeholder: '巡检结果',
        options: result.options,
    },
    // {
    //     name: 'device_name',
    //     type: 'input',
    //     placeholder: '设备名称',
    // },
    {
        name: 'reporter',
        type: 'input',
        placeholder: '巡检人',
    },
]

export const column = [
    {
        label: '所属计划',
        name: 'title',
    },
    {
        label: '所属设备',
        name: 'device_name',
    },
    {
        label: '填报人',
        name: 'reporter',
    },
    {
        label: '现场照片',
        name: 'photo',
        single: true,
    },
    {
        label: '描述',
        name: 'details',
    },
    {
        label: '巡检状态',
        name: 'record_state',
        format: (val) => record_state.dirc[val],
        color: (val) => (val === 1 ? '#299b49' : '#f85726'),
    },
    {
        label: '巡检结果',
        name: 'result',

        format: (val) => result.dirc[val],
        style: (val) => `color: ${val === 1 ? '#239342' : '#E74032'}`,
    },
    {
        label: '巡检时间',
        name: 'create_time',
    },
    {
        title: '操作',
        name: 'action',

        buttons: [],
    },
]
